(eshell-find-alias-function): Return t in the case where the function
authorJohn Wiegley <johnw@newartisans.com>
Tue, 24 Apr 2001 06:32:19 +0000 (06:32 +0000)
committerJohn Wiegley <johnw@newartisans.com>
Tue, 24 Apr 2001 06:32:19 +0000 (06:32 +0000)
was defined in a file, but not part of an eshell module.

lisp/eshell/esh-cmd.el

index 7d5a53625f57fc87014bd1cfd4d1bc7c3642e597..24b51a1f6b8dc3da47ad6c0d6b17e418cd372d79 100644 (file)
@@ -1284,20 +1284,21 @@ COMMAND may result in an alias being executed, or a plain command."
 (defun eshell-find-alias-function (name)
   "Check whether a function called `eshell/NAME' exists."
   (let* ((sym (intern-soft (concat "eshell/" name)))
-        (file (symbol-file sym))
-        module-sym)
+        (file (symbol-file sym)))
+    ;; If the function exists, but is defined in an eshell module
+    ;; that's not currently enabled, don't report it as found
     (if (and file
             (string-match "\\(em\\|esh\\)-\\(.*\\)\\(\\.el\\)?\\'" file))
-       (setq file (concat "eshell-" (match-string 2 file))))
-    (setq module-sym
-         (and sym file (fboundp 'symbol-file)
+       (let ((module-sym
               (intern (file-name-sans-extension
-                       (file-name-nondirectory file)))))
-    (and sym (functionp sym)
-        (or (not module-sym)
-            (eshell-using-module module-sym)
-            (memq module-sym (eshell-subgroups 'eshell)))
-        sym)))
+                       (file-name-nondirectory
+                        (concat "eshell-" (match-string 2 file)))))))
+         (if (and (eshell-using-module module-sym)
+                  (memq module-sym (eshell-subgroups 'eshell)))
+             sym))
+      ;; Otherwise, if it's bound, return it.
+      (if (functionp sym)
+         sym))))
 
 (defun eshell-plain-command (command args)
   "Insert output from a plain COMMAND, using ARGS.